🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / model / src / commonMain / kotlin / org / meshtastic / core / model / BootloaderOtaQuirk.kt
Displaying Raw • Download
core/model/src/commonMain/kotlin/org/meshtastic/core/model/BootloaderOtaQuirk.kt bd2863243bab6eb213401d949839a2bc74dde7e2 (bd286324) Text, 4.45 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.model
Tff7b72import T7ee787kotlinx.serialization.SerialName
Tff7b72import T7ee787kotlinx.serialization.Serializable
T8b949e/** Envelope of the bundled `device_bootloader_ota_quirks.json` asset. */
Tf0883e@Serializable
Tff7b72data Tff7b72class T56d364BootloaderOtaQuirksResponseTb4b4b4(
Tff7b72val Te6edf3devicesTb4b4b4: Te6edf3ListTff7b72<Te6edf3BootloaderOtaQuirkTff7b72> Tff7b72= Te6edf3emptyListTb4b4b4(Tb4b4b4)Tb4b4b4,
T8b949e/**
* Per-model SoftDevice variants. Kept as a separate array from [devices] on purpose: [BootloaderOtaQuirk] is an
* advisory warning that may safely fail open, while this map gates a destructive flash and must fail closed. One
* record carrying both postures would invite a future edit that relaxes the wrong one.
*/
Tf0883e@SerialNameTb4b4b4(Ta5d6ff"Ta5d6ffsoftDeviceVariantsTa5d6ff"Tb4b4b4) Tff7b72val Te6edf3softDeviceVariantsTb4b4b4: Te6edf3ListTff7b72<Te6edf3SoftDeviceVariantEntryTff7b72> Tff7b72= Te6edf3emptyListTb4b4b4(Tb4b4b4)Tb4b4b4,
Tb4b4b4)
T8b949e/**
* The Nordic SoftDevice an nRF52840 board's firmware is linked against. Static hardware fact, derived from the board's
* `build.arduino.ldscript` in `meshtastic/firmware` (`nrf52840_s140_v6.ld` / `_v7.ld`).
*
* Load-bearing for factory erase: the erase images are linked for a specific application start address (0x26000 for
* 6.1.1, 0x27000 for 7.3.0) and the UF2 bootloader's write guard begins at `MBR_SIZE` (0x1000), so the SoftDevice
* region is writable. Flashing the 6.1.1 image to a 7.3.0 device erases the SoftDevice's last page, which needs SWD or
* serial DFU to recover. Never infer this value — an unresolved variant must refuse the operation.
*/
Tff7b72enum Tff7b72class T56d364SoftDeviceVariant Tb4b4b4{
Te6edf3S140_6_1_1Tb4b4b4,
Te6edf3S140_7_3_0Tb4b4b4,
Tb4b4b4;
Tff7b72companion Tff7b72object Tb4b4b4{
T8b949e/**
* Maps the wire value to a variant, returning `null` for anything unrecognized.
*
* The asset carries a `String?` rather than this enum because the shared `Json` sets `coerceInputValues =
* true`, which would silently coerce a typo'd enum value to a default. An unrecognized string lands on `null`
* instead, and `null` refuses.
*/
Tff7b72fun Td2a8fffromWireTb4b4b4(Te6edf3valueTb4b4b4: Tffa657String?Tb4b4b4)Tb4b4b4: Te6edf3SoftDeviceVariant? Tff7b72= Tff7b72when Tb4b4b4(Te6edf3valueTb4b4b4) Tb4b4b4{
Ta5d6ff"Ta5d6ff6.1.1Ta5d6ff" Tff7b72-Tff7b72> Te6edf3S140_6_1_1
Ta5d6ff"Ta5d6ff7.3.0Ta5d6ff" Tff7b72-Tff7b72> Te6edf3S140_7_3_0
Tff7b72else Tff7b72-Tff7b72> Tff7b72null
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
T8b949e/**
* One hardware model's SoftDevice mapping.
*
* @property platformioTargets Every catalog target for this [hwModel]. Resolution requires the device-reported target
* to appear here, because `hwModel` alone is not unique — hwModel 94 (`HELTEC_MESH_POCKET`) has two nRF52840 targets
* — and borrowing a sibling's variant is exactly the mistake that corrupts a SoftDevice.
* @property softDevice Wire value (`"6.1.1"` / `"7.3.0"`), or absent when the variant is unknown. An entry present with
* no `softDevice` records a deliberate, greppable refusal rather than an oversight.
*/
Tf0883e@Serializable
Tff7b72data Tff7b72class T56d364SoftDeviceVariantEntryTb4b4b4(
Tf0883e@SerialNameTb4b4b4(Ta5d6ff"Ta5d6ffhwModelTa5d6ff"Tb4b4b4) Tff7b72val Te6edf3hwModelTb4b4b4: Tffa657IntTb4b4b4,
Tf0883e@SerialNameTb4b4b4(Ta5d6ff"Ta5d6ffhwModelSlugTa5d6ff"Tb4b4b4) Tff7b72val Te6edf3hwModelSlugTb4b4b4: Tffa657String? Tff7b72= Tff7b72nullTb4b4b4,
Tf0883e@SerialNameTb4b4b4(Ta5d6ff"Ta5d6ffplatformioTargetsTa5d6ff"Tb4b4b4) Tff7b72val Te6edf3platformioTargetsTb4b4b4: Te6edf3ListTff7b72<Tffa657StringTff7b72> Tff7b72= Te6edf3emptyListTb4b4b4(Tb4b4b4)Tb4b4b4,
Tf0883e@SerialNameTb4b4b4(Ta5d6ff"Ta5d6ffsoftDeviceTa5d6ff"Tb4b4b4) Tff7b72val Te6edf3softDeviceTb4b4b4: Tffa657String? Tff7b72= Tff7b72nullTb4b4b4,
Tb4b4b4)
Tf0883e@Serializable
Tff7b72data Tff7b72class T56d364BootloaderOtaQuirkTb4b4b4(
T8b949e/** Hardware model id, matches DeviceHardware.hwModel. */
Tf0883e@SerialNameTb4b4b4(Ta5d6ff"Ta5d6ffhwModelTa5d6ff"Tb4b4b4) Tff7b72val Te6edf3hwModelTb4b4b4: Tffa657IntTb4b4b4,
T8b949e/** Optional slug for readability / tooling. */
Tf0883e@SerialNameTb4b4b4(Ta5d6ff"Ta5d6ffhwModelSlugTa5d6ff"Tb4b4b4) Tff7b72val Te6edf3hwModelSlugTb4b4b4: Tffa657String? Tff7b72= Tff7b72nullTb4b4b4,
T8b949e/**
* Indicates that devices usually ship with a bootloader that does not support OTA out of the box and require a
* one-time bootloader upgrade (typically via USB) before DFU updates from the app work.
*/
Tf0883e@SerialNameTb4b4b4(Ta5d6ff"Ta5d6ffrequiresBootloaderUpgradeForOtaTa5d6ff"Tb4b4b4) Tff7b72val Te6edf3requiresBootloaderUpgradeForOtaTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
T8b949e/** Optional URL pointing to documentation on how to update the bootloader. */
Tf0883e@SerialNameTb4b4b4(Ta5d6ff"Ta5d6ffinfoUrlTa5d6ff"Tb4b4b4) Tff7b72val Te6edf3infoUrlTb4b4b4: Tffa657String? Tff7b72= Tff7b72nullTb4b4b4,
Tb4b4b4)
Served by rngit 1.5.0 - Generated in 0.1s